﻿<%@ WebHandler Language="C#" Class="CartDelete" %>

using System;
using System.Web;
using Newtonsoft.Json;

public class CartDelete : IHttpHandler, System.Web.SessionState.IReadOnlySessionState
{
    
    public void ProcessRequest (HttpContext context) {
        OTS.Common.PageSuccess page = new OTS.Common.PageSuccess();
        string _id = context.Request["cartID"];
        if (context.Session["custom"] == null || null == _id || "".Equals(_id) || !OTS.Common.Help.IsNumber(_id))
        {
            page.success = false;
            page.msg = "非法操作！";

        }
        else
        {
            int id = int.Parse(_id);
            OTS.Model.custom custom = (OTS.Model.custom)context.Session["custom"];
            OTS.BLL.CartBLL bll = new OTS.BLL.CartBLL();
            if (bll.Detele(id, custom.cusID))
            {
                page.success = true;
                page.msg = id.ToString();
            }
            else
            {
                page.success = false;
                page.msg = "删除失败！";
            }
        }

        context.Response.ContentType = "application/x-json";
        context.Response.Charset = "utf-8";
        context.Response.Write(JavaScriptConvert.SerializeObject(page));
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}